﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 类和对象_基本语法
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建一个矩形对象
            MyClass lengtn = new MyClass();
            lengtn.lengtn = 2;
            lengtn.width = 6;
            //求周长
            Console.WriteLine(lengtn.Got());



        }


        class MyClass
        {
            //定义长和款
            public int lengtn;
            public int width;

            //求周长
            public int Got()
            {
                return (lengtn + width) * 2;
            }

            //求面积
            public int Get()
            {
                return lengtn * width;
            }
        }
    }
}
